package com.nulldev.util.web.flexibleKit.flexScript.natives.window;

import java.util.Map;

import com.nulldev.util.data.Arrays.maps.FastMaps;
import com.nulldev.util.manage.nullUtil;
import com.nulldev.util.networking.ip.connstatus.NetworkStatusTracker;
import com.nulldev.util.scripting.ScriptAPI.baseJS.legacy.lexer.BaseJSObject;
import com.nulldev.util.scripting.ScriptAPI.baseJS.legacy.lexer.global.BaseJSGlobalVariable;
import com.nulldev.util.web.flexibleKit.general.flexKit;

public class NativeNavigatorObject extends BaseJSObject {

	private static Map<String, BaseJSObject> OBJECTS = FastMaps.map(15);
	static {
		if (OBJECTS.isEmpty()) {
			OBJECTS.put("userAgent", new BaseJSGlobalVariable("userAgent", flexKit.getUserAgent()));
			OBJECTS.put("cookieEnabled", new BaseJSGlobalVariable("cookieEnabled", false));
			OBJECTS.put("javaEnabled", new BaseJSGlobalVariable("javaEnabled", true));
			OBJECTS.put("maxTouchPoints", new BaseJSGlobalVariable("maxTouchPoints", 1));
			OBJECTS.put("vendor", new BaseJSGlobalVariable("vendor", "Hydra"));
			OBJECTS.put("product", new BaseJSGlobalVariable("product", "flexKit"));
			OBJECTS.put("buildID", new BaseJSGlobalVariable("buildID", nullUtil.getVersionString()));
			OBJECTS.put("vendorSub", new BaseJSGlobalVariable("vendorSub", String.valueOf(nullUtil.VERSION)));
			OBJECTS.put("buildSub", new BaseJSGlobalVariable("buildSub", flexKit.VERSION));
			OBJECTS.put("onLine", new BaseJSGlobalVariable("onLine", NetworkStatusTracker.isConnected()));
			OBJECTS.put("hardwareConcurrency", new BaseJSGlobalVariable("hardwareConcurrency", Runtime.getRuntime().availableProcessors()));
		}
	}

	public NativeNavigatorObject() {
		super("navigator", FastMaps.map(OBJECTS));
	}

}
